<template>
  <div>
    <el-container>
      <el-header>
        <div class="header">
          <h2>后台管理</h2>
          <div>
            <span v-if="admin !== ''"
              >管理员&nbsp;&nbsp;&nbsp;&nbsp;{{ admin }}</span
            ><a v-else>未登录</a>
          </div>
        </div>
      </el-header>
      <el-container>
        <el-aside width="200px">
          <el-menu
            default-active="1"
            class="el-menu-vertical-demo"
            background-color="#545c64"
            text-color="#fff"
            active-text-color="#ffd04b"
          >
            <router-link :to="{ name: 'manageUser' }">
              <el-menu-item index="1">
                <i class="el-icon-user-solid"></i>
                <span slot="title">客户管理</span>
              </el-menu-item>
            </router-link>

            <router-link :to="{ name: 'manageTea' }">
              <el-menu-item index="2">
                <i class="el-icon-s-goods"></i>
                <span slot="title">商品管理</span>
              </el-menu-item>
            </router-link>

            <router-link :to="{ name: 'manageOrder' }">
              <el-menu-item index="3">
                <i class="el-icon-tickets"></i>
                <span slot="title">订单管理</span>
              </el-menu-item>
            </router-link>
          </el-menu>
        </el-aside>
        <el-main>
          <router-view></router-view>
        </el-main>
      </el-container>
    </el-container>
  </div>
</template>

<script>
export default {
  name: "adminHome",
  data() {
    return {
      admin: "",
    };
  },
  mounted() {
    this.admin = this.$cookie.get("admin");
  },
};
</script>

<style scoped lang='less'>
.header {
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  & > h2 {
    margin-left: 30px;
    color: #222;
  }
  & > div {
    margin-right: 30px;
    width: 200px;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
  }
}

.el-header,
.el-footer {
  background-color: #b3c0d1;
  color: #333;
  text-align: center;
  line-height: 60px;
}

.el-aside {
  background-color: #d3dce6;
  height: 750px;
  color: #333;
  //   text-align: center;
  //   line-height: 200px;
}

.el-main {
  background-color: #e9eef3;
  color: #333;
  height: 750px;
  //   text-align: center;
  //   line-height: 160px;
}

body > .el-container {
  margin-bottom: 40px;
}

.el-container:nth-child(5) .el-aside,
.el-container:nth-child(6) .el-aside {
  line-height: 260px;
}

.el-container:nth-child(7) .el-aside {
  line-height: 320px;
}
</style>